package com.easy.easy.Service.impl;

import com.easy.easy.Service.LoginService;
import com.easy.easy.bean.Admin;
import com.easy.easy.bean.User;
import com.easy.easy.dao.AdminDao;
import com.easy.easy.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ShoppingLoginService implements LoginService {

    @Autowired

    UserDao userDao;


    @Autowired  // 添加此注解
    AdminDao adminDao;
    @Override
    public User dologin(User user) {
        User user_data=userDao.getUserByUsername(user.getUsername());
        if(user_data!=null&&user.getPassword().equals(user_data.getPassword())){
            return user_data;
        }
       return null;
    }

    @Override
    public Admin doadminlogin(Admin admin) {
        Admin admin_data=adminDao.getAdminByAdminName(admin.getAdminname());
        if(admin_data!=null&&admin_data.getPassword().equals(admin.getPassword())){
            return admin_data;
        }
        return null;
    }


}
